import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:meal/constant/antd_icons.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/route/route.dart';
import 'package:meal/ui/draw_under_line.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

class MessageType extends StatefulWidget {
  const MessageType({Key? key}) : super(key: key);

  @override
  State<MessageType> createState() => _MessageTypeState();
}

class _MessageTypeState extends State<MessageType> {
  Widget get actions {
    return BrnIconAction(
      iconPressed: () {
        BrnDialogManager.showConfirmDialog(context,
            cancel: '取消',
            confirm: '确定',
            message: '标记所有消息为已读?',
            themeData: BrnDialogConfig(
                contentTextStyle: BrnTextStyle(
                    fontSize: Sizes.default18,
                    color: ColorsUtils.parseColorFromHexString(ColorsUtils.color363),
                    fontWeight: FontWeight.normal)), onConfirm: () {
          Navigator.of(context).pop();
        }, onCancel: () {
          Navigator.of(context).pop();
        });
      },
      size: Sizes.default20,
      child: const Icon(
        AntdIcons.clear,
        color: Colors.white,
        size: Sizes.default20,
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: ToolsUtils.getDefaultBrnAppBar('消息', actions: actions),
      body: SingleChildScrollView(
        padding: const EdgeInsets.symmetric(vertical: Sizes.default20, horizontal: Sizes.default15),
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: InkWell(
                onTap: () {
                  Get.toNamed(RouteGet.messageSystemList);
                },
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(
                      width: 40,
                      height: 40,
                      child: Badge(
                        child: ToolsUtils.getUrlSvg(
                            'https://cdn7.axureshop.com/demo/1525603/images/消息中心主页/u5331.svg',
                            width: 30,
                            height: 38),
                      ),
                    ),
                    Expanded(
                        child: DrawUnderLine(
                            color: Colors.black.withOpacity(0.1),
                            dx: Sizes.default10,
                            child: Container(
                              padding: const EdgeInsets.only(
                                  left: Sizes.default10, bottom: Sizes.default15),
                              child: Column(
                                children: [
                                  Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text('系统通知',
                                          style: StylesUtils.customTextStyle(
                                              fontSize: Sizes.default16,
                                              color: ColorsUtils.color363)),
                                      Text('12小时前',
                                          style: StylesUtils.customTextStyle(
                                              fontSize: Sizes.default12, color: ColorsUtils.colorCcc))
                                    ],
                                  ),
                                  Container(
                                    margin: const EdgeInsets.only(top: Sizes.default8),
                                    alignment: Alignment.centerLeft,
                                    child: Text(
                                      '您修改的店铺LOGO审核未通过。',
                                      style: StylesUtils.customTextStyle(
                                          fontSize: Sizes.default13, color: ColorsUtils.color797),
                                      overflow: TextOverflow.ellipsis,
                                      maxLines: 1,
                                    ),
                                  )
                                ],
                              ),
                            )))
                  ],
                ),
              )
            ),
            Container(
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: InkWell(
                onTap: () {
                  Get.toNamed(RouteGet.messageOrderList);
                },
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(
                      width: 40,
                      height: 40,
                      child: Badge(
                        child: ToolsUtils.getUrlSvg(
                            'https://cdn7.axureshop.com/demo/1525603/images/消息中心主页/u5339.svg',
                            width: 30,
                            height: 38),
                      ),
                    ),
                    Expanded(
                        child: DrawUnderLine(
                            color: Colors.black.withOpacity(0.1),
                            dx: Sizes.default10,
                            child: Container(
                              padding: const EdgeInsets.only(
                                  left: Sizes.default10, bottom: Sizes.default15),
                              child: Column(
                                children: [
                                  Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text('订单通知',
                                          style: StylesUtils.customTextStyle(
                                              fontSize: Sizes.default16,
                                              color: ColorsUtils.color363)),
                                      Text('5分钟前',
                                          style: StylesUtils.customTextStyle(
                                              fontSize: Sizes.default12, color: ColorsUtils.colorCcc))
                                    ],
                                  ),
                                  Container(
                                    margin: const EdgeInsets.only(top: Sizes.default8),
                                    alignment: Alignment.centerLeft,
                                    child: Text(
                                      '附近暂无配送员接单，订单已关闭。',
                                      style: StylesUtils.customTextStyle(
                                          fontSize: Sizes.default13, color: ColorsUtils.color797),
                                      overflow: TextOverflow.ellipsis,
                                      maxLines: 1,
                                    ),
                                  )
                                ],
                              ),
                            )))
                  ],
                ),
              )
            ),
            Container(
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: InkWell(
                onTap: () {
                  Get.toNamed(RouteGet.messageActivityList);
                },
                child: Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(
                      width: 40,
                      height: 40,
                      child: Badge(
                        backgroundColor: Colors.transparent,
                        child: ToolsUtils.getUrlSvg(
                            'https://cdn7.axureshop.com/demo/1525603/images/消息中心主页/u5347.svg',
                            width: 30,
                            height: 38),
                      ),
                    ),
                    Expanded(
                        child: DrawUnderLine(
                            color: Colors.black.withOpacity(0.1),
                            dx: Sizes.default10,
                            child: Container(
                              padding: const EdgeInsets.only(
                                  left: Sizes.default10, bottom: Sizes.default15),
                              child: Column(
                                children: [
                                  Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      Text('活动通知',
                                          style: StylesUtils.customTextStyle(
                                              fontSize: Sizes.default16,
                                              color: ColorsUtils.color363)),
                                      Text('09-05',
                                          style: StylesUtils.customTextStyle(
                                              fontSize: Sizes.default12, color: ColorsUtils.colorCcc))
                                    ],
                                  ),
                                  Container(
                                    margin: const EdgeInsets.only(top: Sizes.default8),
                                    alignment: Alignment.centerLeft,
                                    child: Text(
                                      '双十一全平台商家均享订单满₱1…',
                                      style: StylesUtils.customTextStyle(
                                          fontSize: Sizes.default13, color: ColorsUtils.color797),
                                      overflow: TextOverflow.ellipsis,
                                      maxLines: 1,
                                    ),
                                  )
                                ],
                              ),
                            )))
                  ],
                ),
              )
            ),
          ],
        ),
      ),
    );
  }
}
